package net.ozgul.chordmaster;

import java.util.Arrays;
import java.util.List;

import net.ozgul.chordmaster.Chord;
import net.ozgul.chordmaster.ChordType;
import net.ozgul.chordmaster.Note;

import junit.framework.TestCase;

public class ChordTest extends TestCase {
  
  public void testCMajorChordHasCorrectTriads() {
    Chord chord = new Chord(Note.C, ChordType.MAJOR);
    List<Note> spelling = chord.getSpelling();
	Note[] notes = { Note.C, Note.E, Note.G };
    List<Note> expectedSpelling = Arrays.asList(notes);
    assertEquals(expectedSpelling, spelling);
  }
  
  public void testGMajorChordHasCorrectTriads() {
    Chord chord = new Chord(Note.G, ChordType.MAJOR);
    List<Note> spelling = chord.getSpelling();
	Note[] notes = { Note.G, Note.B, Note.D };
    List<Note> expectedSpelling = Arrays.asList(notes);
    assertEquals(expectedSpelling, spelling);
  }
  
  public void testAMinorChordHasCorrectTriads() {
    Chord chord = new Chord(Note.A, ChordType.MINOR);
    List<Note> spelling = chord.getSpelling();
	Note[] notes = { Note.A, Note.C, Note.E };
    List<Note> expectedSpelling = Arrays.asList(notes);
    assertEquals(expectedSpelling, spelling);
  }
  
  public void testFMinorChordHasCorrectTriads() {
    Chord chord = new Chord(Note.F, ChordType.MINOR);
    List<Note> spelling = chord.getSpelling();
	Note[] notes = { Note.F, Note.AFlat, Note.C };
    List<Note> expectedSpelling = Arrays.asList(notes);
    assertEquals(expectedSpelling, spelling);
  }
  
  public void testGetCorrectTriadsForCDiminishedChord() {
    Chord chord = new Chord(Note.C, ChordType.DIMINISHED);
    List<Note> spelling = chord.getSpelling();
	Note[] notes = { Note.C, Note.EFlat, Note.GFlat };
    List<Note> expectedSpelling = Arrays.asList(notes);
    assertEquals(expectedSpelling, spelling);
  }
  
  public void testGetsCorrectTriadsForEDiminishedChord() {
    Chord chord = new Chord(Note.E, ChordType.DIMINISHED);
	List<Note> spelling = chord.getSpelling();
	Note[] notes = { Note.E, Note.G, Note.BFlat };
	List<Note> expectedSpelling = Arrays.asList(notes);
	assertEquals(expectedSpelling, spelling);
  }
  
  public void testGetsCorrectTriadsForCDiminishedSeventhChord() {
	Chord chord = new Chord(Note.C, ChordType.DIMINISHEDSEVENTH);
	List<Note> spelling = chord.getSpelling();
	Note[] notes = { Note.C, Note.EFlat, Note.GFlat, Note.A};
    List<Note> expectedSpelling = Arrays.asList(notes);
	assertEquals(expectedSpelling, spelling);
  }
}
